<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统中心</el-breadcrumb-item>
      <el-breadcrumb-item>借贷管理</el-breadcrumb-item>
      <el-breadcrumb-item>还款管理</el-breadcrumb-item>
      <el-breadcrumb-item>还款计划</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card align="center">
        <el-table :data="getPayList">
          <el-table-column property="repayNum" label="还款总期数" width="150"></el-table-column>
          <el-table-column property="repayNo" label="还款期号" width="150"></el-table-column>
          <el-table-column property="repayDate" label="还款日期" width="200">
            <template slot-scope="scope">
              {{scope.row.repayDate | datefmt('YYYY-MM-DD HH:mm:ss')}}
            </template>
          </el-table-column>
          <el-table-column property="repayAmount" label="应还金额"></el-table-column>
          <el-table-column property="capital" label="本金金额"></el-table-column>
          <el-table-column property="interest" label="利息金额"></el-table-column>
          <el-table-column property="dueDay" label="逾期天数"></el-table-column>
          <el-table-column property="isDue" label="是否逾期" width="200">
            <template slot-scope="scope">
              {{scope.row.isDue==0?"未逾期":"逾期"}}
            </template>
          </el-table-column>
          <el-table-column property="status" label="状态" width="200">
            <template slot-scope="scope">
              {{scope.row.status |statusfilt}}
            </template>
          </el-table-column>
        </el-table>
      <el-button type="primary" @click="back()" style="margin-top: 30px" round>返回</el-button>
    </el-card>
  </div>

</template>

<script>
  export default {
    name: 'Repaybackplan',
    data(){
      return{
        getPayList:[],//还款计划列表
        id:null,//传过来的参数
      }
    },
    methods:{
      back:function(){
        history.back()
      },
      search:function () {
        this.$http.post("/finance-service-borrowing/repay/getRepayPlan/"+this.id).then((res)=>{
          if(res.data.success){
            this.getPayList = res.data.result;
          }else{
            this.$message.error(res.data.message);
          }
        })
      }
    },
    mounted () {
      this.id = this.$route.query.id
      this.search();
    },
    filters:{
      statusfilt:function (val) {
        if(val==0){
          return "待还款"
        }
        if(val==1){
          return "已还款"
        }
        if(val==2){
          return "逾期"
        }
      }
    }
  }
</script>

<style scoped>

</style>
